package com.learn.sunday.es.controller;

import com.learn.sunday.es.compont.JdbcProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@Slf4j
@RequestMapping
@RestController
public class TestController {


    @Value("${jdbc.ip:'12'}")
    private String jdbcUrl;

    @Autowired
    private JdbcProperties jdbcProperties;

    @RequestMapping(value = "test")
    public Object doTest() {
        log.info("url={}",jdbcUrl);
        log.info("Jdbc info: {}", jdbcProperties.getIp());
        return "successful";
    }
}
